package com.example.exception.controller;

import com.example.exception.group.user.AddValidGroup;
import com.example.exception.pojo.UserParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author pdai
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    /**
     * http://localhost:8080/user/add .
     *
     * @param userParam user param
     * @return user
     */
    @PostMapping("add")
    public ResponseEntity<String> add(@Validated(AddValidGroup.class) @RequestBody UserParam userParam) {
            try {

            }catch (Exception e) {
                return ResponseEntity.ok("success");
            }
            return ResponseEntity.ok("success");
    }

}